/**
 * 
 */
package info.niwota.pasta.net;

import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

/**
 * @author qiangli
 * 
 */
public class Client {

	public static void send(String ip, int port, String data) throws Exception {
		Socket s = new Socket(ip, port);
		try {
			ObjectOutputStream out = new ObjectOutputStream(s.getOutputStream());
			ObjectInputStream in = new ObjectInputStream(s.getInputStream());
			out.writeObject(data);
			out.flush();
			in.read(); //wait
		} finally {
			s.close();
		}
	}
}
